<template>
  <view class="top">
    <!-- #ifdef MP-WEIXIN -->
    <uv-navbar
      :fixed="false"
      :title="title"
      left-arrow
      @leftClick="$onClickLeft"
    />
    <!-- #endif -->
    <button type="primary" size="default" class="login-btn" @click="logout">
      {{currentLanguageTexts.ConfirmIn}}
    </button>
    <uv-toast ref="uToast"></uv-toast>
  </view>
</template>

<script setup>
import { ref } from 'vue';
import { useMainStore } from '@/store/store';
import { storeToRefs } from 'pinia';
const main = useMainStore();
const { member, isLogin } = storeToRefs(main);
const uToast = ref();
const title = ref(currentLanguageTexts.value.exit);
const {
  currentLanguageTexts,
} = storeToRefs(main);
const logout = () => {
  uni.removeStorageSync('userinfo');
  uni.removeStorageSync('accessToken');
  main.SET_MEMBER({});
  main.SET_TOKEN('');
  uToast.value.show({
    message: currentLanguageTexts.value.exited,
    type: 'success',
  });
  setTimeout(function () {
    uni.relaunch({
      url: '/pages/components/pages/login/login',
    });
  }, 2000);
};
</script>

<style lang="scss" scoped>
.top {
  display: flex;
  height: 100%;
}
button {
  margin: auto;
}
</style>
